<template>
  <div class="search-body">
    <el-collapse v-model="activeNames">
      <el-form ref="form" :model="form" label-width="164px">
        <div class="search-item" v-for="(list,index) in xdata" :key="index">
          <el-collapse-item :name="list.label">
            <template slot="title"> {{ list.label }} </template>
            <div class="search-form">
              <el-row :gutter="10" style="display:flex; flex-wrap: wrap;">
                <el-col
                  :span="12"
                  v-for="item in list.children"
                  :key="item.label"
                  v-if="item.type == 'text'"
                >
                  <el-form-item :label="item.label">
                    <el-input
                      v-model="form[item.value]"
                      placeholder="请输入内容"
                    />
                  </el-form-item>
                </el-col>
                <el-col
                  :span="12"
                  v-for="item in list.children"
                  :key="item.label"
                  v-if="item.type == 'datetime'"
                >
                  <el-form-item :label="item.label">
                    <el-date-picker
                      v-model="form[item.value]"
                      type="daterange"
                      range-separator="至"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期"
                      value-format="yyyyMMdd"
                    />
                  </el-form-item>
                </el-col>

                <el-col
                  :span="24"
                  v-for="item in list.children"
                  :key="item.label"
                  v-if="item.type == 'radio'"
                >
                  <el-form-item :label="item.label">
                    <el-radio-group v-model="form[item.value]">
                      <el-radio
                        v-for="items in item.children.slice(0, 2)"
                        :key="items.id"
                        :label="items.label"
                      >
                        {{ items.label }}</el-radio
                      >
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item
                    :label="its.label"
                    v-if="
                      form[item.value] == '是' ||
                        form[item.value] == '有' ||
                        form[item.value] == '涉及'
                    "
                    v-for="its in item.children.slice(2, item.children.length)"
                    :key="its.label"
                    style="width:25%;display:inline-block"
                  >
                    <el-input
                      v-model="form[its.value]"
                      @click="qzshuanxin()"
                      placeholder="请输入内容"
                    />
                  </el-form-item>
                </el-col>

                <el-col
                  :span="12"
                  v-for="item in list.children"
                  :key="item.label"
                  v-if="item.type == 'checkbox'"
                >
                  <el-form-item :label="item.label">
                    <el-checkbox-group v-model="form[item.value]">
                      <el-checkbox
                        v-for="items in item.children"
                        :key="items.label"
                        :label="items.label"
                      >
                        {{ items.label }}</el-checkbox
                      >
                    </el-checkbox-group>
                  </el-form-item>
                </el-col>
                <el-col
                  :span="24"
                  v-for="item in list.children"
                  :key="item.label"
                  v-if="item.type == 'titlebtn'"
                >
                  <el-form-item :label="item.label">
                    <el-input
                      v-model="form[item.value]"
                      placeholder="请输入内容"
                      style="width:75%;margin-right:20px"
                    />
                    <el-button round @click="titlebtnClick()">{{
                      item.btnvalue
                    }}</el-button>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
          </el-collapse-item>
        </div>
        <el-form-item class="search-submit-btn">
          <el-button type="primary" @click="onSubmit"
            ><i class="fa fa-search" />检索
          </el-button>
          <el-button @click="qingKong1('form', oldform)"
            ><i class="fa fa-trash-o" />清除全部检索条件</el-button
          >
        </el-form-item>
      </el-form>
    </el-collapse>
  </div>
</template>
